package com.itee.core.serial;


import com.itee.monitor.BaseTestSession;
import org.apache.mina.core.session.IoSession;

/**
 * Created by xin on 2014/4/21 0021.
 */
public class SerialPortFactory {
    /**
     * 仿真测试串口
     */
    public static final String PORT_TEST = "testPort";
    /**
     * 寄存器设置串口
     */
    public static final String PORT_SETTINGS = "settingPort";
    /**
     * 理论测试：基带信号发生器串口
     */
    public static final String RECEIVE_BASEBAND_PORT = "RECEIVE_BASEBAND_PORT";
    /**
     * 理论测试：模块串口
     */
    public static final String RECEIVE_POWER_DAU_PORT = "RECEIVE_POWER_DAU_PORT";

    /**
     * 理论测试：发射模块串口
     */
    public static final String SEND_POWER_DAU_PORT = "SEND_POWER_DAU_PORT";

    /**
     * 衰减测试：智能衰减器
     */
    public static final String EMULATE_PORT = "EMULATE_PORT";

    /**
     * 衰减测试：砝码模块
     */
    public static final String EMULATE_WEIGHT_PORT = "EMULATE_WEIGHT_PORT";

    /**
     * 衰减测试：被测模块
     */
    public static final String EMULATE_DAU_PORT = "EMULATE_DAU_PORT";

    /**
     * 距离覆盖测试2：基带信号发生器串口
     */
    public static final String  POWER_DISTANCE_BASEBAND_PORT = "POWER_DISTANCE_BASEBAND_PORT";
    /**
     * 距离覆盖测试2：模块串口
     */
    public static final String POWER_DISTANCE_DAU_PORT = "POWER_DISTANCE_DAU_PORT";
    /**
     * 干扰测试砝码模块：模块串口
     */
    public static final String DISTURB_SEND_DAU_PORT = "DISTURB_SEND_DAU_PORT";

    /**
     * 干扰测试被测模块：模块串口
     */
    public static final String DISTURB_RECEIVE_DAU_PORT = "DISTURB_RECEIVE_DAU_PORT";

    /**
     * 箱体位置场强校准测试：基带串口
     */
    public static final String POSITION_POWER_BASEBAND_PORT = "POSITION_POWER_BASEBAND_PORT";

    public static SerialSession getSession(String serialName, IoSession session) {

        switch (serialName) {
            case PORT_TEST:
                return new BaseTestSession(session);
//            case RECEIVE_BASEBAND_PORT:
//                return new BasebandSession(session);
//            case RECEIVE_POWER_DAU_PORT:
//                return new ReceivePowerDauSession(session);
//            case PORT_SETTINGS:
//                return new SettingSession(session);
//            case EMULATE_PORT:
//                return new EmulateSession(session);
//            case EMULATE_WEIGHT_PORT:
//                return new EmulateWeightSession(session);
//            case EMULATE_DAU_PORT:
//                return new EmulateDauSession(session);
//            case SEND_POWER_DAU_PORT:
//                return new SendPowerDauSession(session);
//            case POWER_DISTANCE_BASEBAND_PORT:
//                return new PowerDistanceBasebandSession(session);
//            case POWER_DISTANCE_DAU_PORT:
//                return new PowerDistanceDauSession(session);
//            case DISTURB_SEND_DAU_PORT:
//                return new DisturbSendSession(session);
//            case DISTURB_RECEIVE_DAU_PORT:
//                return new DisturbReceiveSession(session);
//            case POSITION_POWER_BASEBAND_PORT:
//                 return new  PositionPowerBasebandSession(session);
            default:
                return null;
        }
    }
}
